import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 * 
 */

/**
 * @author Simon
 *
 */
public class ConsolePanel extends JFrame
{
	private JScrollPane jScrollPane1;
	private JTextArea textArea;



	public ConsolePanel() 
	{
	    super("Console");
	    initComponents();
	}


	private void initComponents() 
	{
	    
	    textArea = new JTextArea();
	    textArea.setColumns(50);
	    textArea.setLineWrap(true);
	    textArea.setRows(10);
	    textArea.setEditable(false);
	    textArea.setWrapStyleWord(true);
	    
	    jScrollPane1 = new JScrollPane(textArea);

	    this.add(jScrollPane1);
	    append("University Research Ranker Console");
	    pack();
	    
	}
	
	public void append(String str)
	{
		textArea.append("> "+str+"\n");
		textArea.setCaretPosition(textArea.getText().length() - 1);
	}
	
	public static void main(String[]args) throws InterruptedException
	{
		ConsolePanel cp = new ConsolePanel();
		cp.setVisible(true);
		
		cp.append("jim");
		Thread.sleep(1000);
		cp.append("test");
		Thread.sleep(1000);
		cp.append("hello");
		Thread.sleep(1000);
		cp.append("jim");
		cp.append("jim");
		Thread.sleep(1000);
		cp.append("test");
		Thread.sleep(1000);
		cp.append("hello");
		Thread.sleep(1000);
		cp.append("jim");
		cp.append("jim");
		Thread.sleep(1000);
		cp.append("test");
		Thread.sleep(1000);
		cp.append("hello");
		Thread.sleep(1000);
		cp.append("jim");
		cp.append("jim");
		Thread.sleep(1000);
		cp.append("test");
		Thread.sleep(1000);
		cp.append("hello");
		Thread.sleep(1000);
		cp.append("jim");
		cp.append("jim");
		Thread.sleep(1000);
		cp.append("test");
		Thread.sleep(1000);
		cp.append("hello");
		Thread.sleep(1000);
		cp.append("jim");
	}

}

